<template>
  <div
    class="footer-ws"
    :style="{
      backgroundColor: backgroundColor,
      color: textColor,
      paddingLeft: paddingLeft,
      paddingRight: paddingRight,
    }"
  >
    <slot name="left"></slot>
    <div class="footer-content">
      <slot name="footerItem"></slot>
      <div class="footer-item" :style="{ width: itemWidth }" v-if="needContact">
        <h3>联系方式</h3>
        <div v-if="footerData.phone">电话：{{ footerData.phone }}</div>
        <div v-if="footerData.fax">传真：{{ footerData.fax }}</div>
        <div v-if="footerData.address">地址：{{ footerData.address }}</div>
      </div>
      <div class="footer-item" v-if="needFriend">
        <h3>合作伙伴</h3>
        <div
          class="friend-link"
          v-for="link in footerData.friendList"
          :key="link.name"
          @click="openLink(link.url)"
        >
          {{ link.name }}
        </div>
      </div>
    </div>
    <slot name="right"></slot>
  </div>
</template>
<script>
export default {
  name: "skyFooter",
  props: {
    footerData: {
      type: Object,
      default: () => {},
    },
    backgroundColor: {
      type: String,
      default: "#333",
    },
    textColor: {
      type: String,
      default: "#fff",
    },
    needContact: {
      type: Boolean,
      default: true,
    },
    needFriend: {
      type: Boolean,
      default: true,
    },
    paddingRight: {
      type: String,
      default: "100px",
    },
    paddingLeft: {
      type: String,
      default: "100px",
    },
    itemWidth: {
      type: String,
      default: "220px",
    },
  },
  methods: {
    openLink(url) {
      if (url) {
        window.open(url, "url", "_blank");
      }
    },
  },
};
</script>

<style lang="less" scoped>
.footer-ws {
  display: flex;
  justify-content: space-around;
}
.footer-content {
  flex: 1;
  display: flex;
  justify-content: space-around;

  .footer-item {
    line-height: 22px;
  }
  .friend-link {
    cursor: pointer;
    &:hover {
      text-decoration: underline;
    }
  }
}
</style>